package com.niit.repository;

import com.niit.entity.Notification;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.Collection;

/**
 * 通知模块数据访问层接口
 */
public interface NotificationRepository extends JpaRepository<Notification, Integer>, JpaSpecificationExecutor<Notification> {

    Page<Notification> findByLevel(Byte level, Pageable pageable);

    Page<Notification> findByTitleContainingAndLevelInAndType(String title, Collection<Byte> levels, Byte type, Pageable pageable);

    Page<Notification> findByTitleContainingAndLevelIn(String title, Collection<Byte> levels, Pageable pageable);

    Page<Notification> findByLevelInAndType(Collection<Byte> levels, Byte type, Pageable pageable);

    Page<Notification> findByLevelIn(Collection<Byte> levels, Pageable pageable);
}